#include <iostream>
#include <limits.h>
#include <float.h>
#include <iomanip>

using std::cout;
using std::endl;
using std::setw;
using std::left;
using std::right;

int main()
{
	char c;
	short s;
	int i;
	long l;
	float f;
	double d;
	long double ld;
	int array[20];
	int *ptr = array;

	cout << "sizeof c = " << sizeof c
		<< "\tsizeof(char) = " << sizeof( char )
		<< "\nsizeof s = " << sizeof s
		<< "\tsizeof(short int) = " << sizeof( short )
		<< "\nsizeof i = " << sizeof i
		<< "\tsizeof(int) = " << sizeof( int )
		<< "\nsizeof l = " << sizeof l
		<< "\tsizeof(long) = " << sizeof( long )
		<< "\nsizeof f = " << sizeof f
		<< "\tsizeof(float) = " << sizeof( float )
		<< "\nsizeof d = " << sizeof d
		<< "\tsizeof(double) = " << sizeof( double )
		<< "\nsizeof ld = " << sizeof ld
		<< "\tsizeof(long double) = " << sizeof( long double )
		<< "\nsizeof array = " << sizeof array
		<< "\nsizeof ptr = " << sizeof( ptr ) << endl;

    cout << endl;

    cout << setw(15) << "TYPE" << setw(25) << "MIN" << setw(25) << "MAX" << endl;
    cout << setw(15) << "char" << setw(25) << CHAR_MIN << setw(25) << CHAR_MAX << endl;
    cout << setw(15) << "short int" << setw(25) << SHRT_MIN << setw(25) << SHRT_MAX << endl;
    cout << setw(15) << "int" << setw(25) << INT_MIN << setw(25) << INT_MAX << endl;
    cout << setw(15) << "long int" << setw(25) << LONG_MIN << setw(25) << LONG_MAX << endl;
    cout << setw(15) << "float" << setw(25) << -FLT_MAX << setw(25) << FLT_MAX << endl;
    cout << setw(15) << "double" << setw(25) << -DBL_MAX << setw(25) << DBL_MAX << endl;
    cout << setw(15) << "long double" << setw(25) << -LDBL_MAX << setw(25) << LDBL_MAX << endl;

	return 0;

/*

   // COMPLETE REFERENCE:

CHAR_BIT   = number of bits in a char
SCHAR_MIN  = minimum value for a signed char
SCHAR_MAX  = maximum value for a signed char
UCHAR_MAX  = maximum value for an unsigned char
CHAR_MIN   = minimum value for a char
CHAR_MAX   = maximum value for a char
MB_LEN_MAX = maximum multibyte length of a character accross locales
SHRT_MIN   = minimum value for a short
SHRT_MAX   = maximum value for a short
USHRT_MAX  = maximum value for an unsigned short
INT_MIN    = minimum value for an int
INT_MAX    = maximum value for an int
UINT_MAX   = maximum value for an unsigned int
LONG_MIN   = minimum value for a long
LONG_MAX   = maximum value for a long
ULONG_MAX  = maximum value for an unsigned long
LLONG_MIN  = minimum value for a long long
LLONG_MAX  = maximum value for a long long
ULLONG_MAX = maximum value for an unsigned long long

// Where U*_MIN is omitted for obvious reasons (any unsigned type has a minimum value of 0).

Similarly float.h provides limits for float and double types:

FLT_MIN  = min value of a float
FLT_MAX  = max value of a float
DBL_MIN  = min value of a double
DBL_MAX  = max value of a double
LDBL_MIN = min value of a long double
LDBL_MAX = max value of a long double

*/

}

